﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="receive.aspx.cs" Inherits="AnyOffice.general.sms.receive" %>

<%@Register TagPrefix="Webdiver" Namespace="Webdiver" Assembly="AspnetPager" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>短信息</title>
			
		<script Language="JavaScript">
function delete_all()
{
	msg="确认要删除所有已接收的短信息吗？"; 
	if(window.confirm(msg))
		return true
	else
		return false;
}

 function CheckAll( checkAllBox )                         
 {                                                                  
 var frm = document.Form1;
  var ChkState=checkAllBox.checked;                   
  for(i=0;i< frm.length;i++)                                 
  {                                                                 
         e=frm.elements[i];                                   
        if(e.type=='checkbox' && e.name.indexOf('SmsId') != -1)
            e.checked= ChkState ;                        
  }                                                               
 }                                                                
                           
function CheckChanged()                                   
{                                                                   
  var frm = document.Form1;                              
  var boolAllChecked;                                         
  boolAllChecked=true;                                       
  for(i=0;i< frm.length;i++)                                 
  {                                                                 
    e=frm.elements[i];                                        
  if ( e.type=='checkbox' && e.name.indexOf('SmsId') != -1 )
      if(e.checked== false)                                  
      {                                                             
         boolAllChecked=false;                               
         break;                                                    
      }                                                              
  }                                                                  
  for(i=0;i< frm.length;i++)                                  
  {                                                                  
    e=frm.elements[i];                                         
    if ( e.type=='checkbox' && e.name.indexOf('checkAll') != -1 )
    {                                                            
      if( boolAllChecked==false)                         
         e.checked= false ;                                
      else                                                    
         e.checked= true;                                  
      break;                                                    
    }                                                             
   }                                                              
 }
 
function delete_sms()
{
	var checkNums=0;
	var checkList = document.getElementsByTagName("input");
	for(i=0;i<checkList.length;i++)
	{
		if((checkList[i].type == "checkbox") && (checkList[i].id != "checkAll"))
		{
			if(checkList[i].checked)
				checkNums++;
		}
	}
	
	if(checkNums==0)
	{
		alert("要删除短信，请至少选择其中一条。");						
		return false;
	}
	
	msg='确认要删除所选短消息么？';
	if(window.confirm(msg))
		return true
	else
		return false;
}

function cancel_remind()
{
	var checkNums=0;
	var checkList = document.getElementsByTagName("input");
	for(i=0;i<checkList.length;i++)
	{
		if((checkList[i].type == "checkbox") && (checkList[i].id != "checkAll"))
		{
			if(checkList[i].checked)
				checkNums++;
		}
	}
	
	if(checkNums==0)
	{
		alert("要取消短消息提醒，请至少选择其中一条。");						
		return false;
	}
	
	msg='确认要取消所选短消息么提醒？';
	if(window.confirm(msg))
		return true
	else
		return false;
} 
                                                             
		</script>
	</HEAD>
	<body class="bodycolor" style="padding-top:0;" topmargin="5"> 
		<form id="Form1" method="post" runat="server">
         <div class="main_div">
			<table class="small" cellSpacing="0" cellPadding="3" width="100%" border="0">
				<tr>
					<td noWrap class="tab_ti"><SPAN class="big3">
							已接收的短信息</SPAN></td>
					<td align="center">
						<asp:Literal id="litNavCount" runat="server"></asp:Literal>
					</td>
					<td align="center">
						<asp:Literal id="litNavPager" runat="server"></asp:Literal>
					</td>
					<td align="right">			
						<asp:Button id="btnDeleteAll" runat="server" Text="全部删除" CssClass="bnt_Del" Width="70" ToolTip="删除所有已接收的短信息" onclick="btnDeleteAll_Click"></asp:Button><asp:Button id="btnReadAll" runat="server" Text="全部取消提醒" CssClass="bnt_Del" Width="100" ToolTip="删除所有已接收的短信息" onclick="btnReadAll_Click"></asp:Button>
					</td>
				</tr>
			</table>
			<asp:Panel id="pnlMain" runat="server">
				<TABLE width="100%" cellSpacing="0" cellPadding="0" border="0" class="tab_pub" align="center">
					<TR>
						<TD class="TableHeader" noWrap align="center">选择</TD>
						<TD class="TableHeader" noWrap align="center">类别</TD>
						<TD class="TableHeader" noWrap align="center">发送人</TD>
						<TD class="TableHeader" noWrap align="center" width="50%">内容</TD>
						<TD class="TableHeader" noWrap align="center">发送时间</TD>
						<TD class="TableHeader" noWrap align="center">状态</TD>
						<TD class="TableHeader" noWrap align="center">操作</TD>			
					</TR>
					<asp:Repeater id="rptSms" runat="server">
						<ItemTemplate>
							<TR class="TableLine1">
								<TD align="center"><input type="checkbox" runat="server" id="SmsId" onClick="CheckChanged();" name="SmsId" value='<%#Eval("SmsId")%>' /></TD>
								<TD align="center">
								<!-- 如果为个人短信则显示个性头像-->
								<IMG title="<%#Eval("CodeName")%>" src="/images/<%# (Convert.ToInt32(Eval("Type").ToString()) == 0)?("avatar/" + Eval("Avatar").ToString()):("sms_type" + Eval("Type").ToString()) %>.gif">
								</TD>
								<TD noWrap align="center"><%#Eval("UserName")%></TD>
								<TD><%#formatContent(Eval("Content").ToString())%></TD>
								<TD noWrap align="center"><%#Eval("SendTime")%></TD>
								<TD noWrap align="center"><%# (Convert.ToBoolean(Eval("RemindFlag").ToString()) == true)?"<img src=\"/images/email_new.gif\" title=\"未读\">":"<img src=\"/images/email_open.gif\" title=\"已读\">"%></TD>
								<TD noWrap align="center">
									<!--个人信息有回复选项-->
									<%#(Convert.ToInt32(Eval("Type")) ==0) ?"&nbsp;<A href='new.aspx?sms_id=" + Eval("SmsId").ToString() + "&to_id=" + Eval("FromId").ToString() + "&to_name=" + Eval("UserName").ToString() + "'>回复</a>":""%>													
								</TD>
							</TR>
						</ItemTemplate>
						<AlternatingItemTemplate>
						<TR class="TableLine2">
								<TD align="center"><input type="checkbox" runat="server" id="SmsId" onClick="CheckChanged();" name="SmsId" value='<%#Eval("SmsId")%>' /></TD>
								<TD align="center">
								<!-- 如果为个人短信则显示个性头像-->
								<IMG title="<%#Eval("CodeName")%>" src="/images/<%# (Convert.ToInt32(Eval("Type").ToString()) == 0)?("avatar/" + Eval("Avatar").ToString()):("sms_type" + Eval("Type").ToString()) %>.gif">
								</TD>
								<TD noWrap align="center"><%#Eval("UserName")%></TD>
								<TD><%#formatContent(Eval("Content").ToString())%></TD>
								<TD noWrap align="center"><%#Eval("SendTime")%></TD>
								<TD noWrap align="center"><%# (Convert.ToBoolean(Eval("RemindFlag").ToString()) == true)?"<img src=\"/images/email_new.gif\" title=\"未读\">":"<img src=\"/images/email_open.gif\" title=\"已读\">"%></TD>
								<TD noWrap align="center">
									<!--个人信息有回复选项-->
									<%#(Convert.ToInt32(Eval("Type")) ==0) ?"&nbsp;<A href='new.aspx?sms_id=" + Eval("SmsId").ToString() + "&to_id=" + Eval("FromId").ToString() + "&to_name=" + Eval("UserName").ToString() + "'>回复</a>":""%>
								</TD>
							</TR>
						</AlternatingItemTemplate>
					</asp:Repeater>
				</TABLE>
				<table width="100%" cellpadding="0" class="div_cotr" cellspacing="0" border="0">
					<TR>
						<TD>
						    <INPUT id="checkAll" onClick="CheckAll(this);" style="float:left; margin-left:25px;" type="checkbox" name="checkAll">
						    <label class="fl">全部选中</label>
										<asp:Button id="btnDelete" runat="server" ToolTip="删除所选短消息" CssClass="bnt05 fl" Text="删 除" onclick="btnDelete_Click"></asp:Button>
										<asp:Button id="btnCancelRemind" runat="server" ToolTip="取消所选的短信息提醒" CssClass="bnt06 fl" Text="取消提醒" onclick="btnCancelRemind_Click"></asp:Button>
						    <div class="fr">
										<Webdiver:AspNetPager id="AspNetPager1" runat="server" CssClass="small1" InputBoxClass="SmallInput" SubmitButtonClass="bnt05"
											Font-Size="10pt" OnPageChanged="ChangePage" HorizontalAlign="Right" ShowCustomInfoSection="left" ShowInputBox="Always"
											SubmitButtonText="转 到" NumericButtonTextFormatString="[{0}]" UrlPaging="False" CustomInfoSectionWidth="35%"
											PagingButtonSpacing="0" ImagePath="../images" ButtonImageNameExtension="n" CpiButtonImageNameExtension="r"
											DisabledButtonImageNameExtension="g" PageSize="10" AlwaysShow="True"></Webdiver:AspNetPager>
							</div>
						</TD>
					</TR>
				</TABLE>
			</asp:Panel>
			<asp:Literal id="litMessage" runat="server"></asp:Literal>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
            </div>
		</form>
		 
	</body>
</HTML>
